package rsj.table;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class BaseZTree {
	
	private String id; 
	private String pId; 
	private String name; 
	private String text; 
	private String nodeType; 
	private boolean isParent; 
	private boolean open; 
	private List<BaseZTree> children = new ArrayList<BaseZTree>();
	private int position; 
	public BaseZTree() { 
		
	} 
	public BaseZTree(String id, String name, String pId) { 
		this.id = id; 
		this.name = name; 
		this.pId = pId;
	} 
	/**
     * 节点其他属性，传递其他属性zTree控件需要这样配置
     */ 
	private Map<String, String> attributes = new HashMap<String, String>();
	private String icon;
	
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getpId() {
		return pId;
	}
	public void setpId(String pId) {
		this.pId = pId;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getText() {
		return text;
	}
	public void setText(String text) {
		this.text = text;
	}
	public String getNodeType() {
		return nodeType;
	}
	public void setNodeType(String nodeType) {
		this.nodeType = nodeType;
	}
	public boolean isParent() {
		return isParent;
	}
	public void setParent(boolean isParent) {
		this.isParent = isParent;
	}
	public boolean isOpen() {
		return open;
	}
	public void setOpen(boolean open) {
		this.open = open;
	}
	public List<BaseZTree> getChildren() {
		return children;
	}
	public void setChildren(List<BaseZTree> children) {
		this.children = children;
	}
	public int getPosition() {
		return position;
	}
	public void setPosition(int position) {
		this.position = position;
	}
	public Map<String, String> getAttributes() {
		return attributes;
	}
	public void setAttributes(Map<String, String> attributes) {
		this.attributes = attributes;
	}
	public String getIcon() {
		return icon;
	}
	public void setIcon(String icon) {
		this.icon = icon;
	} 
	
	 public void addChildren(BaseZTree baseZTree) { 
		 List<BaseZTree> nodes = this.getChildren(); 
		 if (nodes == null) { 
			 List<BaseZTree> list = new ArrayList<>();
			 list.add(baseZTree);
			 this.setChildren(list); 
		}else{ 
			nodes.add(baseZTree); 
		} 
	}
	

}
